package com.iflytek.xfapi.controller;

import com.iflytek.xfapi.pptMade.utils.api.PPTGenerator;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/xfapi/pptMade")
public class PptMageController {

    /**
     *
     * @param query:ppt标题
     * @param author：作者
     * @param theme：主题
     * @return
     */
    @PostMapping("/{query}/{author}/{theme}")
    public String getPpt(@PathVariable("query") String query,@PathVariable("author") String author,@PathVariable("theme") String theme){
        System.out.println("打印一下" + query);
        System.out.println("打印一下" + author);
        System.out.println("打印一下" + theme);
        PPTGenerator generator = new PPTGenerator();
        String s = null;
        try {
            s = generator.generatePPT(query,author,theme);
            System.out.println("打印一下" + s);
        } catch (InterruptedException e) {
            s =  "系统开小差了！请耐心等待或联系工作人员";
            throw new RuntimeException(e);
        }
        System.out.println("打印一下" + s);
        return s;

    }
}
